package com.nbsaas.boot.shopArticle.rest.resource;

import com.nbsaas.boot.shopArticle.api.apis.ShopArticleApi;
import com.nbsaas.boot.shopArticle.data.entity.ShopArticle;
import com.nbsaas.boot.shopArticle.api.domain.request.ShopArticleRequest;
import com.nbsaas.boot.shopArticle.api.domain.response.ShopArticleResponse;
import com.nbsaas.boot.shopArticle.api.domain.simple.ShopArticleSimple;
import com.nbsaas.boot.shopArticle.rest.convert.ShopArticleSimpleConvert;
import com.nbsaas.boot.shopArticle.rest.convert.ShopArticleEntityConvert;
import com.nbsaas.boot.shopArticle.rest.convert.ShopArticleResponseConvert;
import com.nbsaas.boot.shopArticle.data.repository.ShopArticleRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class ShopArticleResource extends BaseResource<ShopArticle,ShopArticleResponse, ShopArticleSimple, ShopArticleRequest>  implements ShopArticleApi {

    @Resource
    private ShopArticleRepository shopArticleRepository;

    @Override
    public JpaRepositoryImplementation<ShopArticle, Serializable> getJpaRepository() {
        return shopArticleRepository;
    }

    @Override
    public Function<ShopArticle, ShopArticleSimple> getConvertSimple() {
        return new ShopArticleSimpleConvert();
    }

    @Override
    public Function<ShopArticleRequest, ShopArticle> getConvertForm() {
        return new ShopArticleEntityConvert();
    }

    @Override
    public Function<ShopArticle, ShopArticleResponse> getConvertResponse() {
        return new ShopArticleResponseConvert();
    }




}


